# -*- python -*-
# Copyright (C) 2003, Charles Wang.
# Author:  Charles Wang <charles@linux.net.cn>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANT; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public LIcense for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, 59 Temple
# Place - Suite 330, Boston, MA 02111-1307, USA.

Import('*')

depInstall(env, 'root_src',
           mi_config.destdir + '/etc/init.d',
           ['apply-dbgopts', 'modules', 'network', 'syslogd',
            'create-devenv', 'import-cmdline',
            'tftpd', 'rcK', 'rcS', 'RunMagicInstaller'])

depInstallAs(env, 'root_src',
             '$destdir/etc/init.d/mountall',
             'mountall-%s' % mi_config.mikernelver[:3])

dbgopts_cmds = ['echo "#/bin/sh" > $TARGET',
                'echo "/bin/mkdir -p /tmpfs/debug" >> $TARGET']
for opt in mi_config.debugopts:
    dbgopts_cmds.append('echo "cat /dev/null > /tmpfs/debug/%s" >> $TARGET' % opt)
dbgopts_cmds.append('chmod +x $TARGET')

env.Command('apply-dbgopts', [], dbgopts_cmds)
